<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SOP</title>
<link href="resources/styles/main.css" rel="stylesheet" type="text/css" />
<link type="text/css" href="resources/scripts/jquery-ui-1.8.14.custom/css/start/jquery-ui-1.8.14.custom.css" rel="stylesheet" />
<script type="text/javascript" src="resources/scripts/jquery-ui-1.8.14.custom/js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="resources/scripts/jquery-ui-1.8.14.custom/js/jquery-ui-1.8.14.custom.min.js"></script>
<script type="text/javascript" src="resources/scripts/jquery-ui-1.8.14.custom/js/jquery.blockUI.js"></script>
<script type="text/javascript">

function checkFields()
{
	if($('#term').val()=='' || $('#term').val()==-1)
	{
		alert('请选择学期');
		return false;
	}
	return true;
}



//检查用户名
function checkUsername(username)
{
	var reg = /^[a-zA-Z0-9_]+$/;
	return reg.test(username);
}


function checkCount()
{
	for(var i=1; i<=10; i++)
	{
		var r1 = parseInt($('.compare'+i+'-1').val());
		var r2 = parseInt($('.compare'+i+'-2').val());
		var r3 = parseInt($('.compare'+i+'-3').val());
		var r4 = parseInt($('.compare'+i+'-4').val());
		
		if(r1 < r3)
			return [i,1];
		if(r2 < r4)
			return [i,2];
	}
	return 0;
}

function resetStyle()
{
	for(var i=1; i<=10; i++)
	{
		$('.compare'+i+'-1').css('background', '#FFF');
		$('.compare'+i+'-2').css('background', '#FFF');
		$('.compare'+i+'-3').css('background', '#FFF');
		$('.compare'+i+'-4').css('background', '#FFF');
	}
}


$(document).ready(function(){
	$( "#cdate" ).datepicker();
	
	$('#dialogResetConfirm').dialog({ 
		autoOpen: false,
		model: true,
		buttons:
			{
				'是': function(){ $('#classTermForm')[0].reset(); $(this).dialog('close');},
				'否': function(){ $(this).dialog('close');}
			}
	})
	
	$('.submitForm').click(function(){
		resetStyle();
		if(!checkFields())
		{
			return false;
		}
		var errnum = checkCount();
		if(errnum != 0)
		{
			alert('检测到有误数据，请返回提示颜色处检查');
			if(errnum[1]==1)
			{
				$('.compare'+errnum[0]+'-1').css('background', '#f90');
				$('.compare'+errnum[0]+'-3').css('background', '#f90');
			}
			else
			{
				$('.compare'+errnum[0]+'-2').css('background', '#f90');
				$('.compare'+errnum[0]+'-4').css('background', '#f90');
			}
			return false;
		}
		else
		{
			$('#classTermForm').submit();
			return true;
		}
	});
	
		
	$('.resetForm').click(function(){
		$('#dialogResetConfirm').dialog('open');
	});
	
	$('#repwdMy').dialog({ 
		autoOpen: false,
		buttons: {
				"提交": function() {
						if(!checkUsername($('#oldpwdMy').val()))
						{
							$('#errMsgRepwdMy').html('密码不能为空');
							return;
						}
						if(!(checkUsername($('#repwdInputMy').val())))
						{
							$('#errMsgRepwdMy').html('密码不能为空');
							return;
						}
						if($('#repwdInputMy').val() != $('#repwdInputConfirmMy').val())
						{
							$('#errMsgRepwdMy').html('密码和确认密码不一致');
							return;
						}
						$('#errMsgRepwdMy').html('<span style="color: green;"></span>');
						$.post(
							'<!--{spUrl c=main a=changeMyPwd}-->',
							{
								'oldpwd': $('#oldpwdMy').val(),
								'pwd': $('#repwdInputMy').val(),
								'selectedUser' : "<!--{$user.id}-->"
							},
							function(data) {
								if(data == -1)
								{
									$('#errMsgRepwdMy').html('密码错误');
									return;
								}
								alert('密码修改成功');
								window.location.reload();
							}
						);
					},
				"关闭": function() {
						$(this).dialog('close');
					}
			}
		});
	
		$('.repwdLinkMy').click(function(){
			$('#repwdMy').dialog('open');
			return false;
		});
	
	$('#term').change(function(){
			window.location.href="<!--{spUrl c=unit_class a=term}-->"+"&termid="+$('#term').val();	
	});
				
	
});
</script>

<style>
div.ui-datepicker{
 font-size:10px;
}
</style>

</head>

<body>
<div id="dialogResetConfirm" title="重置表单" style="displayl: none;">
	<p>是否要重置整个表单？</p>
</div>
<div id="repwdMy" style="width: 320px; height: 240px; display:none;">
  <form method="POST">
    <table>
      <tr>
      	<td colspan="2"><span style="color: #900; " id="errMsgRepwdMy"></span></td>
      </tr>
      <tr>
        <td>旧密码：</td>
        <td><input id="oldpwdMy" type="password" name="oldpwdMy"/></td>
      </tr>
      <tr>
        <td>新密码：</td>
        <td><input id="repwdInputMy" type="password" name="repwdInputMy" /></td>
      </tr>
      <tr>
        <td>重复新密码：</td>
        <td><input id="repwdInputConfirmMy" type="password" name="repwdInputConfirmMy" /></td>
      </tr>
    </table>
  </form>
</div>
<table width="100%" height="316" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<table border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="63" valign="top" background="resources/images//bgc10.gif" style="padding:30px 0px 0px 35px"><table width="93%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td bgcolor="#8ac281" class="b06"><!--{$school.schoolname}--><!--{$school.classname}--></td>
            <td><img src="resources/images//bgc11.gif" width="26" height="52" /></td>
          </tr>
        </table></td>
        <td align="right"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
               <td height="23" align="right"><span class="b05"> 您好， </span><span class="b07"><!--{$school.classname}--></span><span class="b05"> 上次登录：</span><span class="b16"><!--{$user.last_login_date}--> </span><span class="b05">[<a href="<!--{spUrl c=main a=logout}-->">安全登出</a>]  [<a href="#" class="repwdLinkMy">密码修改</a>] </span></td>
            </tr>
            
          </table>
          </td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td background="resources/images//bgc02.gif"><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-top:5px">
      <tr>
        <td height="40" colspan="2"><img src="resources/images//bgc05.gif" align="absmiddle" /><span class="b01">信息录入</span></td>
        </tr>
      <tr>
        <td width="56%" height="1" background="resources/images//bgc04.gif"></td>
        <td width="44%" background="resources/images//bgc04.gif"></td>
      </tr>
    </table>
  <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" background="resources/images//bgc08.gif" style="margin:25px auto 15px auto">
          <tr>
            <td height="32" style="padding-left:15px"><table border="0" cellspacing="0" cellpadding="0">
                <tr>
                   <td><table border="0" cellpadding="0" cellspacing="0" class="b03">
                    <tr>
                      <td><a href="<!--{spUrl c=unit_class a=index}-->">班级·天活动</a></td>
                    </tr>
                </table></td>
                <td><table border="0" cellpadding="0" cellspacing="0" class="b02">
                    <tr>
                      <td><a href="#">班级·综合</a></td>
                    </tr>
                </table></td>
                </tr>
            </table></td>
          </tr>
        </table>
        
      <form action="<!--{spUrl c=unit_class a=postTerm}-->" method="POST" id="classTermForm">
        <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr><td colspan="2"><span style="color: #096; font-weight: bold;">注意：请先选择学期。</span></td></tr>
           <tr>
            <td>选择学期：<select id="term" name="termid">
                	<option value="-1" <!--{if $termid==-1}-->selected="selected"<!--{/if}-->>--请选择--</option>
            	<!--{foreach from=$terms item=one}-->
                	<option value="<!--{$one.id}-->" <!--{if $termid==$one.id}-->selected="selected"<!--{/if}-->><!--{$one.termname}--></option>
                <!--{/foreach}-->
            </select></td>
            <td align="right" style="padding-left:15px"><a href="<!--{spUrl c=export_tables a=index}-->"><img src="resources/images/cj125.gif" align="absmiddle" /></a></td>
          </tr>
        </table>
      <table border="0" align="center" cellpadding="0" cellspacing="0" style="margin:15px auto 25px auto">
          <tr>
            <td><img src="resources/images//ke15.gif" width="864" height="5" /></td>
          </tr>
          <tr>
            <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#dfdfdf">
              <col width="23" />
              <col width="53" />
              <col width="21" />
              <col width="125" />
              <col width="53" />
              <col width="45" span="4" />
              <col width="37" />
              <col width="41" />
              <col width="45" span="3" />
              <col width="37" />
              <col width="29" />
              <col width="37" />
              <col width="45" />
              <col width="29" />
              <col width="45" />
              <tr height="29">
                <td width="8%" height="58" rowspan="3" align="center" bgcolor="#FFFFFF" class="b09">学生分类</td>
                <td width="6%" rowspan="3" align="center" bgcolor="#FFFFFF" class="b09">人数</td>
                <td colspan="3" align="center" bgcolor="#FFFFFF" class="b09">学生留守情况</td>
                <td height="58" colspan="3" rowspan="2" align="center" bgcolor="#FFFFFF" class="b09">双留学生教养体系</td>
                <td height="58" rowspan="2" colspan="2" align="center" bgcolor="#FFFFFF" class="b09">单亲家庭</td>
                <td height="58" rowspan="2" align="center" bgcolor="#FFFFFF" class="b09">                  孤儿</td>
              </tr>
              <tr height="29">
                <td height="25" colspan="2" align="center" bgcolor="#FFFFFF" class="b09">父母一方在外</td>
                <td width="6%" rowspan="2" align="center" bgcolor="#FFFFFF" class="b09">父母双方<br />
                在外</td>
              </tr>
              <tr height="29">
                <td width="6%" height="25" align="center" bgcolor="#FFFFFF" class="b09">父亲在外</td>
                <td width="6%" align="center" bgcolor="#FFFFFF" class="b09">母亲在外</td>
                <td width="6%" align="center" bgcolor="#FFFFFF" class="b09">隔代</td>
                <td width="6%" align="center" bgcolor="#FFFFFF" class="b09">亲友</td>
                <td width="6%" align="center" bgcolor="#FFFFFF" class="b09">寄养</td>
                <td width="3%" align="center" bgcolor="#FFFFFF" class="b09">父单</td>
                <td width="3%" align="center" bgcolor="#FFFFFF" class="b09">母单</td>
                <td width="7%" align="center" bgcolor="#FFFFFF" class="b09">人数</td>
              </tr>
              
              <tr height="32">
                <td align="center" bgcolor="#FFFFFF" class="b09">男生</td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a0_0" value="<!--{$data.a0_0}-->" type="text" class="b11 compare1-1" id="a0_0" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a0_1" value="<!--{$data.a0_1}-->" type="text" class="b11 compare2-1" id="a0_1" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a0_2" value="<!--{$data.a0_2}-->" type="text" class="b11 compare3-1" id="a0_2" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a0_3" value="<!--{$data.a0_3}-->" type="text" class="b11 compare4-1" id="a0_3" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a0_4" value="<!--{$data.a0_4}-->" type="text" class="b11 compare5-1" id="a0_4" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a0_5" value="<!--{$data.a0_5}-->" type="text" class="b11 compare6-1" id="a0_5" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a0_6" value="<!--{$data.a0_6}-->" type="text" class="b11 compare7-1" id="a0_6" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a0_7_1" value="<!--{$data.a0_7_1}-->" type="text" class="b11 compare8-1" id="a0_7" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a0_7_2" value="<!--{$data.a0_7_2}-->" type="text" class="b11 compare9-1" id="a0_8" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a0_8" value="<!--{$data.a0_8}-->" type="text" class="b11 compare10-1" id="a0_9" size="3" /></td>
              </tr>
              <tr height="32">
                <td align="center" bgcolor="#FFFFFF" class="b09">女生</td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a1_0" value="<!--{$data.a1_0}-->" type="text" class="b11 compare1-2" id="a1_0" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a1_1" value="<!--{$data.a1_1}-->" type="text" class="b11 compare2-2" id="a1_1" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a1_2" value="<!--{$data.a1_2}-->" type="text" class="b11 compare3-2" id="a1_2" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a1_3" value="<!--{$data.a1_3}-->" type="text" class="b11 compare4-2" id="a1_3" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a1_4" value="<!--{$data.a1_4}-->" type="text" class="b11 compare5-2" id="a1_4" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a1_5" value="<!--{$data.a1_5}-->" type="text" class="b11 compare6-2" id="a1_5" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a1_6" value="<!--{$data.a1_6}-->" type="text" class="b11 compare7-2" id="a1_6" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a1_7_1" value="<!--{$data.a1_7_1}-->" type="text" class="b11 compare8-2" id="a1_7" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a1_7_2" value="<!--{$data.a1_7_2}-->" type="text" class="b11 compare9-2" id="a1_8" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a1_8" value="<!--{$data.a1_8}-->" type="text" class="b11 compare10-2" id="a1_9" size="3" /></td>
              </tr>
              <tr height="32">
                <td align="center" bgcolor="#FFFFFF" class="b09">住宿男生</td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a2_0" value="<!--{$data.a2_0}-->" type="text" class="b11 compare1-3" id="a2_0" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a2_1" value="<!--{$data.a2_1}-->" type="text" class="b11 compare2-3" id="s2_1" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a2_2" value="<!--{$data.a2_2}-->" type="text" class="b11 compare3-3" id="s2_2" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a2_3" value="<!--{$data.a2_3}-->" type="text" class="b11 compare4-3" id="a2_3" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a2_4" value="<!--{$data.a2_4}-->" type="text" class="b11 compare5-3" id="a2_4" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a2_5" value="<!--{$data.a2_5}-->" type="text" class="b11 compare6-3" id="a2_5" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a2_6" value="<!--{$data.a2_6}-->" type="text" class="b11 compare7-3" id="a2_6" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a2_7_1" value="<!--{$data.a2_7_1}-->" type="text" class="b11 compare8-3" id="a2_7" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a2_7_2" value="<!--{$data.a2_7_2}-->" type="text" class="b11 compare9-3" id="a2_8" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a2_8" value="<!--{$data.a2_8}-->" type="text" class="b11 compare10-3" id="a2_9" size="3" /></td>
              </tr>
              <tr height="32">
                <td align="center" bgcolor="#FFFFFF" class="b09">住宿女生</td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a3_0" value="<!--{$data.a3_0}-->" type="text" class="b11 compare1-4" id="a3_0" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a3_1" value="<!--{$data.a3_1}-->" type="text" class="b11 compare2-4" id="a3_1" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a3_2" value="<!--{$data.a3_2}-->" type="text" class="b11 compare3-4" id="a3_2" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a3_3" value="<!--{$data.a3_3}-->" type="text" class="b11 compare4-4" id="a3_3" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a3_4" value="<!--{$data.a3_4}-->" type="text" class="b11 compare5-4" id="a3_4" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a3_5" value="<!--{$data.a3_5}-->" type="text" class="b11 compare6-4" id="a3_5" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a3_6" value="<!--{$data.a3_6}-->" type="text" class="b11 compare7-4" id="a3_6" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a3_7_1" value="<!--{$data.a3_7_1}-->" type="text" class="b11 compare8-4" id="a3_7" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a3_7_2" value="<!--{$data.a3_7_2}-->" type="text" class="b11 compare9-4" id="a3_8" size="3" /></td>
                <td height="32" align="center" bgcolor="#FFFFFF"><input name="a3_8" value="<!--{$data.a3_8}-->" type="text" class="b11 compare10-4" id="a3_9" size="3" /></td>
              </tr>
            </table>
            </td>
        </tr>
          <tr>
            <td><img src="resources/images//ke14.gif" width="864" height="5" /></td>
          </tr>
        </table>
      <table width="45%" border="0" align="center" cellpadding="0" cellspacing="0" style="margin:10px auto 10px auto ">
        <tr>
          <td width="23%" height="30" align="center"><a href="#" class="submitForm"><img src="resources/images//ni.gif" width="66" height="19" /></a></td>
          <td width="23%" align="center"><a class="resetForm" style="cursor: pointer; cursor; hand\9;"><img src="resources/images//nii.gif" width="66" height="19" /></a></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td><img src="resources/images//bgc03.gif" width="960" height="20" /></td>
  </tr>
</table>
</form>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="b04">
  <tr>
    <td height="80">&nbsp;</td>
  </tr>
</table>
</body>
</html>
